package com.exam.examtest.adapter

import android.text.format.DateUtils
import com.blankj.utilcode.util.TimeUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.exam.examtest.R
import com.exam.examtest.bean.HttpRecordBean

/**
 * ClassName HttpRecordAdapter
 * Create by rhf
 * Create on 2021/4/5 15:19
 * Description 请求记录数据adapter
 */
class HttpRecordAdapter(
    resourceId: Int,
    data: List<HttpRecordBean>?
) : BaseQuickAdapter<HttpRecordBean, BaseViewHolder>(resourceId, data) {

    override fun convert(helper: BaseViewHolder, item: HttpRecordBean?) {

        val timeFormat = TimeUtils.millis2String(item?.httpTimeStamp!!, "yyyy-MM-dd HH:mm:ss")
        helper.setText(R.id.tvTime, String.format("请求时间：%s", timeFormat))//时间

        helper.setText(R.id.tvUrl, String.format("请求地址：%s",item.saveUrlOrData))//请求地址

    }

}